import os
import re
import random
import datetime
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "anjian.settings")

import django

if django.VERSION >= (1, 7):
    django.setup()
from aj.ajgl import models1
from aj import models

for i in range(100):
    dsr=random.choice(['张三','李四','王五','赵柳','王麻子'])
    time1=datetime.datetime.strptime('20200101','%Y%m%d').date()+datetime.timedelta(random.randint(1,180))
    users=models.UserInfo.objects.all()[2:]
    user=random.choice(users)
    dic={
        "aj_xingzhi":random.choices(population=['1','2'],weights=[0.8,0.2],k=1)[0],
        "aj_zhonglei":str(random.randint(1,15)),
        "aj_laiyuan":str(random.randint(1,8)),
        "aj_time1":time1,
        "aj_anyou":dsr+'涉嫌依法应当***而未经***案',
        "aj_dangshiren":dsr,
        "aj_faren":"测试法人",
        "aj_jigoudaima":"4100000"+str(random.randint(100,999)),
        "aj_sheanjine":random.randint(100,10000),
        "aj_time2":time1+datetime.timedelta(random.randint(2,5)),
        "aj_zhuangtai":"2",
        "aj_juedingshu":"模拟决定书",
        "aj_chufayiju":"模拟处罚依据",
        "aj_chufajine":random.randint(100,10000),
        "aj_heiwodian":random.choices(population=['1','2'],weights=[0.2,0.8],k=1)[0],
        "aj_wfss":"模拟违法事实",
        "aj_user":user,
        "sheng":user.organization.xingzhengquhua.sheng,
        "shi":user.organization.xingzhengquhua.shi,
        "xian":user.organization.xingzhengquhua.xian,
    }
    models1.Anjian.objects.create(**dic)
